
//键盘按下事件
$(window).keydown(function(event){
	var key = event.keyCode;
	if($("#mainView").get(0).style.display == 'block'){
		switch(key){
			//向左走
			case 37:
			HERO.name = heroName + 'l';
			document.getElementById(HERO.x+" "+HERO.y).src="img/gameViewIMG/"+HERO.name+".jpg";
			heroNextPoint.x = HERO.x;
			heroNextPoint.y = HERO.y - 1;
			heroMove();
			break;
			//向上走
			case 38:
			HERO.name = heroName + 't';
			document.getElementById(HERO.x+" "+HERO.y).src="img/gameViewIMG/"+HERO.name+".jpg";
			heroNextPoint.x = HERO.x - 1;
			heroNextPoint.y = HERO.y;
			heroMove();
			break;
			
			//向右走
			case 39:
			HERO.name = heroName + 'r';
			document.getElementById(HERO.x+" "+HERO.y).src="img/gameViewIMG/"+HERO.name+".jpg";
			heroNextPoint.x = HERO.x;
			heroNextPoint.y = HERO.y + 1;
			heroMove();
			break;
			
			//向下走
			case 40:
			HERO.name = heroName;
			document.getElementById(HERO.x+" "+HERO.y).src="img/gameViewIMG/"+HERO.name+".jpg";
			heroNextPoint.x = HERO.x + 1;
			heroNextPoint.y = HERO.y;
			heroMove();
			break;
			
			//空格放火球
			case 32:
					fireBall(HERO,heroName,userFireBallArray);
					fireVoice();
			break;
		}
	}
});
